"use strict";

const { Controller } = require("egg");

class TvController extends Controller {
  async getClassify() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.tv.getClassify(data);
    ctx.success(ret);
  }
  async addClassify() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.tv.addClassify(data);
    ctx.success(ret);
  }
  async deleteClassify() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.tv.deleteClassify(data);
    ctx.success(ret);
  }
  async updateClassify() {
    const { ctx, service } = this;
    let dat = ctx.request.body;
    let query = ctx.query;
    let ret = await service.tv.updateClassify(dat);
    ctx.success(ret);
  }
  async getTeleplayList() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    data.query = data?.query ?? {};
    let ret  = await service.tv.getTeleplayList(data);
    ctx.success(ret);
  }

  async getTeleplayInfo() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.tv.getTeleplayInfo(data);
    ctx.success(ret);
  }
  async getTeleplayPlay() {
    const { ctx, service } = this;
    let data = ctx.request.body;
    let query = ctx.query;
    let ret = await service.tv.getTeleplayPlay(data);
    ctx.success(ret);
  }

  /**web */
  async searchByPreset() {
    const { ctx, service } = this;
    let dat = ctx.request.body;
    let query = ctx.query;
    let ret = await service.tv.searchByPreset(dat);
    ctx.success(ret);
  }
  async addTeleplay() {
    const { ctx, service } = this;
    let dat = ctx.request.body;
    let query = ctx.query;
    let ret = await service.tv.addTeleplay(dat);
    ctx.success(ret);
  }
  async deleteTeleplay() {
    const { ctx, service } = this;
    let dat = ctx.request.body;
    let query = ctx.query;
    let ret = await service.tv.deleteTeleplay(dat);
    ctx.success(ret);
  }
  async updateTeleplayInfo() {
    const { ctx, service } = this;
    let dat = ctx.request.body;
    let query = ctx.query;
    let ret = await service.tv.updateTeleplayInfo(dat);
    ctx.success(ret);
  }


}

module.exports = TvController;
